'''
crc
Author: Alex Foran
'''

import operator,math

'''
Performs a simple crc calculation on a file, returning the result.
'''
def crcsimple(file):
	#get file data
	file=open(file,'r')
	data=file.read()
	file.close()
	#add up all ascii values and return
	return reduce(operator.add,map(ord,data))

'''
Performs a slightly cryptographized crc, returning the result.
'''
def crccipher_crypt(char):
	#silly math that means nothing
	return math.pow(ord(char),2)%256

'''
Performs a silly cipher crc, returning the result.
'''
def crccipher(file):
	#get file data
	file=open(file,'r')
	data=file.read()
	file.close()
	#you know, I don't really know what this does, but it's cool. so there.
	return int(reduce(operator.add,map(crccipher_crypt,data)))